home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / MacTechNotes / Platforms & Tools / Stand-Alone Code Folder / GetQDGlobsƒ / GetQDGlobs.p
Encoding:
Text File  |  1990-07-30  |  857 b   |  40 lines  |  [TEXT/MPS ]

  1.  
  2. UNIT GetQDGlobs;
  3.  
  4. INTERFACE
  5.  
  6.     USES
  7.         Types, QuickDraw, OSUtils;
  8.     
  9.     TYPE
  10.         QDVarRecPtr    =    ^QDVarRec;
  11.         QDVarRec    =    RECORD
  12.                             randSeed    : Longint;
  13.                             screenBits    : BitMap;
  14.                             arrow        : Cursor;
  15.                             dkGray        : Pattern;
  16.                             ltGray        : Pattern;
  17.                             gray        : Pattern;
  18.                             black        : Pattern;
  19.                             white        : Pattern;
  20.                             thePort        : GrafPtr;
  21.                         END;
  22.  
  23.     PROCEDURE GetMyQDVars (VAR qdVars: QDVarRec);
  24.  
  25. IMPLEMENTATION
  26.  
  27.     PROCEDURE GetMyQDVars (VAR qdVars: QDVarRec);
  28.     TYPE
  29.         LongPtr = ^Longint;
  30.     BEGIN
  31.         { Algorithm:
  32.             1.  Get current value of A5 with SetCurrentA5.
  33.             2.  Dereference to get address of thePort.
  34.             3.  Perform arithmetic to determine address of randSeed.
  35.             4.  By assignment, copy the QD globals into a local data structure. }
  36.         qdVars := QDVarRecPtr( LongPtr(SetCurrentA5)^ - (SizeOf(QDVarRec) - SizeOf(thePort)) )^;
  37.     END;
  38.  
  39. END.
  40.